package zx.x.modules.sys.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import zx.x.modules.sys.entity.ChildrenVolunteerApplyEntity;
import zx.x.modules.sys.service.ChildrenVolunteerApplyService;
import zx.x.common.utils.PageUtils;
import zx.x.common.utils.R;



/**
 * 
 *
 * @author x
 * @email x
 * @date 2022-02-25 15:44:25
 */
@RestController
@RequestMapping("/childrenvolunteerapply")
public class ChildrenVolunteerApplyController {
    @Autowired
    private ChildrenVolunteerApplyService childrenVolunteerApplyService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    // @RequiresPermissions("x:childrenvolunteerapply:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = childrenVolunteerApplyService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //  @RequiresPermissions("x:childrenvolunteerapply:info")
    public R info(@PathVariable("id") Integer id){
		ChildrenVolunteerApplyEntity childrenVolunteerApply = childrenVolunteerApplyService.getById(id);

        return R.ok().put("childrenVolunteerApply", childrenVolunteerApply);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //  @RequiresPermissions("x:childrenvolunteerapply:save")
    public R save(@RequestBody ChildrenVolunteerApplyEntity childrenVolunteerApply){
		childrenVolunteerApplyService.save(childrenVolunteerApply);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //   @RequiresPermissions("x:childrenvolunteerapply:update")
    public R update(@RequestBody ChildrenVolunteerApplyEntity childrenVolunteerApply){
		childrenVolunteerApplyService.updateById(childrenVolunteerApply);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //   @RequiresPermissions("x:childrenvolunteerapply:delete")
    public R delete(@RequestBody Integer[] ids){
		childrenVolunteerApplyService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
